/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.crystalrange.documents.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.crystalrange.model.User;

/**
 *
 * @author Krzysiek
 */
public class DocumentVersion {
    private Long id;
    private Long major;
    private Long minor;
    private String description;
    private Date createdDate;
    private User createdBy;
    private Document document;
    private List<DocumentReference> parentDocumentReferences;
    private List<DocumentReference> childDocumentReferences;
    private List<DocumentVersionFile> documentVersionFiles;
    
//    public void removeParentDocumentReference(DocumentReference documentReference) {
//    	this.getDocument().removeParentDocumentReference(documentReference);
//    	this.parentDocumentReferences.remove(documentReference);
//    }
    
    public DocumentVersion() {
        this.parentDocumentReferences = new ArrayList<DocumentReference>();
        this.childDocumentReferences = new ArrayList<DocumentReference>();
        this.documentVersionFiles = new ArrayList<DocumentVersionFile>();
    }
    
    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMajor() {
        return major;
    }

    public void setMajor(Long major) {
        this.major = major;
    }

    public Long getMinor() {
        return minor;
    }

    public void setMinor(Long minor) {
        this.minor = minor;
    }

    public Document getDocument() {
        return document;
    }

    public void setDocument(Document document) {
        this.document = document;
    }
    
    public String getVersion() {
    	return this.major.toString() + "." + this.minor.toString();
    }

    public List<DocumentReference> getChildDocumentReferences() {
        return childDocumentReferences;
    }

    public void setChildDocumentReferences(List<DocumentReference> childDocumentReferences) {
        this.childDocumentReferences = childDocumentReferences;
    }

    public List<DocumentReference> getParentDocumentReferences() {
        return parentDocumentReferences;
    }

    public void setParentDocumentReferences(List<DocumentReference> parentDocumentReferences) {
        this.parentDocumentReferences = parentDocumentReferences;
    }

	public List<DocumentVersionFile> getDocumentVersionFiles() {
		return documentVersionFiles;
	}

	public void setDocumentVersionFiles(
			List<DocumentVersionFile> documentVersionFiles) {
		this.documentVersionFiles = documentVersionFiles;
	}
}
